<template>
    <div>
        <!-- <el-form ref="form" :model="form" label-width="80px">
  <el-form-item label="活动名称">
    <el-input v-model="form.name"></el-input>
  </el-form-item> -->
  <el-form ref="form" :model="form" label-width="80px" style="width:600px">
        <el-radio label="A:"></el-radio>
        <el-input  style="width:300px"></el-input>

        <el-upload
  class="avatar-uploader"
  action="https://jsonplaceholder.typicode.com/posts/"
  :show-file-list="false"
  :on-success="handleAvatarSuccess"
  :before-upload="beforeAvatarUpload">
  <img v-if="imageUrl" :src="imageUrl" class="avatar">
  <span>上传图片</span>
  <i class="el-icon-circle-close icon"></i>
</el-upload>
</el-form>
    </div>
</template>

<script>
// 单选多选
// 1.用v-if，else判断，如果选择的是单选，就显示4个。
export default {
  name: 'ManagementIndex',

  data () {
    return {
      imageUrl: '',
      form: {}
    }
  },

  mounted () {

  },

  methods: {
    handleAvatarSuccess () {
      console.log('handleAvatarSuccess')
    },
    // 点击选择图片会触发的事件
    beforeAvatarUpload () {
      console.log('beforeAvatarUpload')
    }
  }
}
</script>

<style lang="scss" scoped>
     .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
   span{
    font-size: 14px;
    color: #8c939d;
    width: 100px;
    height: 60px;
    line-height: 60px;
    text-align: center;
  }
  .avatar {
    width: 100px;
    height: 60px;
    background-color: #fff;
    border-radius: 1px dashed #d9d9d9;
    display: inline-block;
  }
//   上传图片的样式
  ::v-deep .el-upload {
    display: inline-block;
    position: relative;
    margin-left: 5px;
    width: 100px;
    height: 60px;
    background-color: #fff;
    border: 1px dashed #d9d9d9;
    border-radius: 5px;

  }
  ::v-deep .avatar-uploader {
    width: 100px;
    display: inline-block;
  }
  .icon {
    position: absolute;
    top: -10px;
    right:5px;
    background: #fff;
    font-size: 18px;
    color: #999;
  }
</style>
